<#import "../macro/components.ftl" as components/>
<#include "../macro/layout_default.ftl"/>

<@head>
<link rel="stylesheet" href="/misc/app/css/product_list.css"/>
</@head>

<@body>
<script src="/misc/app/js/prize_list.js"></script>
<script src="/misc/jquery-fileupload-9.14.0/jquery.ui.widget.js"></script>
<script src="/misc/jquery-fileupload-9.14.0/jquery.fileupload.js"></script>
<script>var PicDomain = "${PicDomain!}"</script>
</@body>

<@layout_default>


<!--===========点击“新增奖品”按钮，显示新建奖品页面  start================--->
<div class="box" name="md_add_prize">
  <div class="box-header with-border">
    <!--<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
    -->
    <h4 class="box-title"><i class="fa fa-plus"></i> 新增奖品</h4>
  </div>
  <div class="box-body">
    <form class="form-horizontal" name="form_new_prize">
      <div class="form-group">
        <label class="col-sm-2 control-label"><strong class="text-red bold">*</strong> 奖品名称</label>
        <div class="col-sm-10">
          <input type="text" class="form-control" placeholder="奖品名称" name="name" maxlength="200"/>
        </div>
      </div>
      <div class="form-group">
        <label class="col-sm-2 control-label"><strong class="text-red bold">*</strong> 奖品类型</label>
        <div class="col-sm-10">
          <select class="form-control" name="type">
            <option value="">请选择类型</option>
            <option value="1">红包</option>
            <option value="2">实物</option>
            <option value="3">优惠券</option>
          </select>
        </div>
      </div>
      <div class="form-group">
        <label class="col-sm-2 control-label"><strong class="text-red bold">*</strong> 价格</label>
        <div class="col-sm-10">
          <input type="text" class="form-control" placeholder="价格" name="price"/>
        </div>
      </div>
      <div class="form-group">
        <label class="col-sm-2 control-label"><strong class="text-red bold">*</strong> 库存</label>
        <div class="col-sm-10">
          <input type="text" class="form-control" placeholder="库存" name="stock"/>
        </div>
      </div>
      <div class="form-group">
        <label class="col-sm-2 control-label"><strong class="text-red bold">*</strong> 配送方式</label>
        <div class="col-sm-10">
          <select class="form-control" name="shippingMethod">

          </select>
        </div>
      </div>


      <div class="form-group" style="display:none" id="site">
        <label class="col-sm-2 control-label"><strong class="text-red bold">*</strong> 兑奖网点</label>
        <div class="col-sm-10">
          <button type="button" class="btn btn-default" name="btn_select_product" data-toggle="modal"
                  data-target="#selectedBranch_modals"><i class="fa fa-plus"></i> 兑奖网点
          </button>
        </div>
      </div>
      <div class="form-group" id="selectedProDiv" style="display:none">
        <label class="col-sm-2 control-label"></label>
        <div class="col-sm-10">
          <table class="table table-striped table-hover">
            <thead>
            <tr>
              <th>ID</th>
              <th>手机号</th>
              <th>兑奖网点</th>
              <th>地址</th>
              <th>联系人</th>
              <!--<th>操作</th>-->
            </tr>
            </thead>
            <tbody id="prize_new_table">
              <#if selectPBList?exists>
                <#list selectPBList as item1>
                <tr>
                  <td>${item1.id}</td>
                  <td>${item1.linkPhone}</td>
                  <td>${item1.name}</td>
                  <td>${item1.address}</td>
                  <td>${item1.linkMan}</td>
                  <!--<td><button type="button" class="btn btn-default btn-xs" name="btn_delete_prize_branch" data-prize-branch-id="${item1.id?c}">删除</button></td>-->
                </tr>
                </#list>
              </#if>
            </tbody>
          </table>
        </div>
      </div>

      <div class="form-group">
        <label class="col-sm-2 control-label"><strong class="text-red bold">*</strong>奖品图片</label>
        <div class="col-sm-10">
          <p class="help-block"><i class="fa fa-info-circle text-yellow"></i>点击预览图可删除图片， 图片数量限制3张</p>
          <span class="ctn-product-pics" id="ctn_new_product_pics"></span>
          <input type="file" id="ipt_new_product_upload_pic" class="hide" name="file"/>
          <button type="button" class="btn-upload-productimg" name="btn_new_product_upload_pic"><i
              class="fa fa-plus"></i></button>
        </div>
      </div>
      <div class="form-group">
        <label class="col-sm-2 control-label"><strong class="text-red bold">*</strong>奖品介绍</label>
        <div class="col-sm-10">
          <input type="text" class="form-control" placeholder="简介" name="summary" maxlength="300" />
        </div>
      </div>


    </form>
  </div>
  <div class="box-footer text-center">
    <button type="button" class="btn btn-default" name="btn_cancel_new_prize">取消</button>
    <button type="button" class="btn btn-primary" name="btn_save_new_prize">保存</button>
  </div>
</div>
<!--===========点击“新增奖品”按钮，显示新建奖品页面  end================--->

<!--===========Modals  点击“选择网点”按钮，显示网点列表   start================--->
<div class="modal" id="selectedBranch_modals" tabindex="-1">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
        <h5 class="modal-title"><i class="fa fa-plus"></i> 兑奖网点</h5>
      </div>
      <span class="pull-right text-muted" style="margin: 14px 10px 0 0;">共 ${branchList.resultTotal} 条记录</span>
      <form class="form-inline" action="">
        <div class="input-group">
          <div class="input-group-addon">关键字</div>
          <input type="text" class="form-control" style="width: 260px" name="keyword" value="${keyword!}"
                 placeholder="兑奖网点、手机号"/>
        </div>

        <button type="button" class="btn btn-warning" name="pro_query"><i class="fa fa-search"></i> 查询</button>
      </form>
      <div class="modal-body">
        <table class="table table-striped table-hover">
          <thead>
          <tr>
            <th><input type="checkbox" id="selectAll" name="selectAll"/></th>
            <th>ID</th>
            <th>兑奖网点</th>
            <th>手机号码</th>
            <th>地址</th>
            <th>联系人</th>
          </tr>
          </thead>
          <tbody id="branch_modal">
            <#list branchList.result as item>
            <tr>
              <td><input type="checkbox" name="branch" value="${item.id!}"/></td>
              <td>${item.id}</td>
              <td class="name_${item.id!}">${item.name}</td>
              <td class="linkPhone_${item.id!}">${item.linkPhone}</td>
              <td class="address_${item.id!}">${item.address}</td>
              <td class="linkMan_${item.id!}">${item.linkMan!}</td>
            </tr>
            </#list>
          </tbody>
        </table>
      </div>

      <div class="box-footer text-center" id="page_model" data-total="${branchList.pageTotal}"
           data-size="${branchList.pageSize}">
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal" id="selectPro_cancel">取消</button>
        <button type="button" class="btn btn-primary" data-dismiss="modal" id="selectPro_confirm">确认</button>
      </div>

    </div>
  </div>
</div>
<!--===========Modals  点击“选择网点”按钮，显示网点列表   end================--->

</@layout_default>